<template>
    <BasePanel width="256px" height="100%" title="蓝天保卫战">
        <template #default>
            <div class="panel-content">
                <div class="value-box">
                    <span class="label">里程碑进度</span>
                    <span class="value">{{ panelData.progress }}</span>
                </div>
                <div class="value-box-2">
                    <span class="label">总数</span>
                    <span class="value">{{ panelData.total }}</span>
                </div>
                <PercentBar :list="panelData.listData" />
                <div class="value-box-3">
                    <div class="item" v-for="item in panelData.listData" :key="item.name">
                        <div class="label-box">
                            <span class="dot" :style="{ backgroundColor: item.color }"></span>
                            <span class="label">{{ item.name }}</span>
                        </div>
                        <div class="value">
                            <span :style="{ color: item.color }">{{ item.value }}</span>
                            <span>/</span>
                            <span>{{ item.rate }}</span>
                        </div>
                    </div>
                </div>
            </div>
        </template>
    </BasePanel>
</template>

<script setup lang="ts">
import BasePanel from '@/components/BasePanel/index.vue'
import PercentBar from '@/components/PercentBar/index.vue'

const panelData = reactive({
    progress: '98.8%',
    total: 68120,
    listData: [
        {
            name: '已完成',
            color: 'rgba(1, 254, 133, 1)',
            value: 6732,
            rate: '89.4%',
        },
        {
            name: '未完成',
            color: 'rgba(245, 68, 85, 1)',
            value: 797,
            rate: '10.6%',
        },
    ],
})
</script>

<style scoped lang="scss">
.panel-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    .value-box {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;

        .label {
            font-size: 20px;
            font-weight: 700;
            line-height: 20px;
            color: rgba(255, 255, 255, 1);
            height: 20px;
        }

        .value {
            font-size: 28px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 28px;
            color: rgba(1, 254, 133, 1);
            font-family: Oswald;
            height: 28px;
        }
    }

    .value-box-2 {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .label {
            font-size: 18px;
            font-weight: 700;
            line-height: 18px;
            color: rgba(255, 255, 255, 1);
            height: 18px;
        }

        .value {
            font-size: 24px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 24px;
            color: rgba(1, 254, 133, 1);
            font-family: Oswald;
            height: 24px;
        }
    }

    .value-box-3 {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .item {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: flex-start;
            gap: 8px;

            .label-box {
                display: flex;
                align-items: center;
                gap: 4px;
                .dot {
                    width: 14px;
                    height: 14px;
                    display: block;
                }

                .label {
                    font-size: 16px;
                    font-weight: 700;
                    line-height: 16px;
                    color: rgba(255, 255, 255, 1);
                }
            }

            .value {
                display: flex;
                align-items: center;
                gap: 2px;
                font-family: Oswald;
                font-size: 20px;
                font-weight: 400;
                line-height: 20px;
                height: 20px;
                color: rgba(255, 255, 255, 1);
            }
        }
    }
}
</style>
